//测试环境 http://dev.mizhi.com
//真实 http://www.mizhi.com/

/*if(window.location.hostname=='http://oa.ds99.me'){
 var INF_CONFIG = 'http://oa.ds99.me';
 }else{
 var INF_CONFIG = 'idy.lfq.gov.cn';
 }*/
//import $ from './zepto.min';
//var INF_CONFIG = process.env.API_ROOT;
import appConfigs from '../../config.js';

var INF_CONFIG = appConfigs.URLWEBHTTP;

// var INF_CONFIG = 'http://idy.lfq.gov.cn'
// var INF_CONFIG = 'http://120.52.98.115'
// var INF_CONFIG = 'http://lfq.gov.cn/'

function baseAjax(method, url, data, fnSuccess, fnFaild) {

  $.ajax({
    type: method,
    cache: false,
    url: url,
    data: data,
    dataType: 'json',
    xhrFields: {
      withCredentials: true,
    },

    success: function (re) {
      if (re.status == -555) {
        window.location.href = './#/login'
      } else if (re.status == -999) {
        window.location.href = './#/login'
      } else {
        fnSuccess && fnSuccess(re)
      }
    },
    error: function (re) {
      fnFaild && fnFaild(re)
    }
  })
}

//接口配置
var REQUEST_CONFIG = {
  //数据字典
  menuList: INF_CONFIG + 'direct/Menu/menuList',//左侧菜单

  getUserInfo: INF_CONFIG + 'direct/Menu/getUserInfo',//获取用户信息
  loginUrl: INF_CONFIG + 'direct/login/check_user',
  logout: INF_CONFIG + 'direct/Login/logout',//退出
  MessageList: INF_CONFIG + 'direct/Massage/MessageList',
  MessageDetail: INF_CONFIG + 'direct/Massageadmin/getMessageDetail',

  targetList: INF_CONFIG + 'direct/Directadmin/targetList',//部门分类
  MessageGroup: INF_CONFIG + 'direct/Massage/MessageGroup',//诉求分类

  getMessage: INF_CONFIG + 'direct/Massageadmin/getMessage',//获取通知接口
  userAnalysis: INF_CONFIG + 'direct/Massageadmin/userAnalysis',//获取通知接口

  getLibraryGroupList: INF_CONFIG + 'direct/Massage/getLibraryGroup',//企业类型接口
  getDirectArea: INF_CONFIG + 'direct/Massage/getDirectArea',//地区获取接口

  //运营人员接口
  MaddAndTransfer: INF_CONFIG + 'direct/Massageadmin/addAndTransfer',//运营人员 新增页面-> 移交按钮
  MuserAdd: INF_CONFIG + 'direct/Massageadmin/userAdd',//运营人员 新增页面-> 保存按钮
  delfile: INF_CONFIG + 'direct/Massage/delfile',//附件删除
  yyAccept: INF_CONFIG + 'direct/Massageadmin/yyAccept',//运营受理

  MgetEditInfo: INF_CONFIG + 'direct/Massageadmin/getEditInfo',//运营人员 获取编辑详情
  targetListByType: INF_CONFIG + 'direct/Directadmin/targetListByType',//部门总分类，包含区县和市级
  userEdit: INF_CONFIG + 'direct/Massageadmin/userEdit',//编辑保存
  editAndTransfer: INF_CONFIG + 'direct/Massageadmin/editAndTransfer',//编辑移交接口
  MgetWaitList: INF_CONFIG + 'direct/Massageadmin/getWaitList',//首页诉求列表
  MgetTransferInfo: INF_CONFIG + 'direct/Massageadmin/getTransferInfo',//首页诉求列获取移交信息
  MuserTransfer: INF_CONFIG + 'direct/Massageadmin/userTransfer',//首页诉求取移操作
  MgetAllList: INF_CONFIG + 'direct/Massageadmin/getAllList',// 诉求跟进列表
  addAttendant: INF_CONFIG + 'direct/Massageadmin/addAttendant',// 新增管理账号
  delAttendant: INF_CONFIG + 'direct/Massageadmin/delAttendant',// 删除管理账号
  getAttendantInfoById: INF_CONFIG + 'direct/Massageadmin/getAttendantById',// 获取管理员信息
  editAttendantInfo: INF_CONFIG + 'direct/Massageadmin/editAttendantInfo',// 编辑下保存管理员信息
  conclude: INF_CONFIG + 'direct/Massageadmin/conclude',// 编辑下保存管理员信息
  userConfirm: INF_CONFIG + 'direct/Question/userConfirm',// 评价功能
  accountManage: INF_CONFIG + 'direct/Massageadmin/accountManage',// 账号管理

  //运行局
  yxAppealList: INF_CONFIG + 'direct/Massageadmin/yxAppealList',// 申诉列表
  doAppeal: INF_CONFIG + 'direct/Massageadmin/doAppeal',//申诉处理
  questionAnswer: INF_CONFIG + 'direct/Answer/questionAnswer',//追答接口
  AnswerWatch: INF_CONFIG + 'direct/Massageadmin/watch',//追答接口
  Qsupervise: INF_CONFIG + 'direct/Massageadmin/supervise',//诉求督办接口
  QuserDelete: INF_CONFIG + 'direct/Massageadmin/userDelete',//诉求删除接口
  MyxTransfer: INF_CONFIG + 'direct/Massageadmin/yxTransfer',// 核准操作
  goBackToYY: INF_CONFIG + 'direct/Massageadmin/goBackToYY',// 退回操作
  forceConclude: INF_CONFIG + 'direct/Massageadmin/forceConclude',// 运行局强制办结

  //委办部门接口
  wbWaitList: INF_CONFIG + 'direct/Massageadmin/wbWaitList	',//待办列表
  wbAllList: INF_CONFIG + 'direct/Massageadmin/wbAllList',//诉求跟进列表

  // 首页诉求列表受理
  ShouLiOption: INF_CONFIG + "direct/Massageadmin/Accept",
  // 首页诉求列表申诉
  ShenSuOption: INF_CONFIG + "direct/Massageadmin/wbAppeal",
  // 数据统计
  EventStatusList: INF_CONFIG + "direct/Questioncount/departmentSituations.html",
  ChartData: INF_CONFIG + "direct/Questioncount/groupRate.html",
  getUserList: INF_CONFIG + "direct/Massageadmin/getUserList",

  //一、	网办大厅分类
  getGroupList: INF_CONFIG + "direct/Directhandlegroup/getGroupList",//1.分类列表
  addGroup: INF_CONFIG + "direct/Directhandlegroup/addGroup",//.新增分类
  getEditInfo: INF_CONFIG + "direct/Directhandlegroup/getEditInfo",//获取编辑信息
  WdoGroupEdit: INF_CONFIG + "direct/Directhandlegroup/doEdit",//编辑分类
  Wsearch: INF_CONFIG + "direct/Directhandlegroup/search",//查询分类
  Wgroupdel: INF_CONFIG + "direct/Directhandlegroup/del",//删除分类
  //二、	分类下各项目
  getListByGroup: INF_CONFIG + "direct/Directhandle/getListByGroup",//项目列表
  GroupdoAdd: INF_CONFIG + "direct/Directhandle/doAdd",//添加项目
  WgetEditInfo: INF_CONFIG + "direct/Directhandle/getEditInfo",//获取编辑信息
  WdoEdit: INF_CONFIG + "direct/Directhandle/doEdit",//编辑项目
  WproDel: INF_CONFIG + "direct/Directhandle/del",//删除项目
  //企业端
  comlogin: INF_CONFIG + "home/Zqlogin/login",//登录
  comlogout: INF_CONFIG + "home/Zqlogin/logout",//企业用户推出
  comGetUserInfo: INF_CONFIG + "direct/Usercentre/getUserInfo",//企业用户信息
  getLibraryGroup: INF_CONFIG + "direct/Usercentre/getLibraryGroup",//获取企业类型
  comEditUserInfo: INF_CONFIG + "direct/Usercentre/editUserInfo",//获取企业类型
  comGetArea: INF_CONFIG + "direct/Usercentre/getArea",//获取企业类型
  getUserMseeageList: INF_CONFIG + "direct/Usercentre/getUserMseeageList",//获取企业类型
  MseeageByQuestionNum: INF_CONFIG + "direct/Massage/MseeageByQuestionNum",//获取详情
  reTransfer: INF_CONFIG + "direct/Massageadmin/reTransfer",//重新分配接口

  printContent: INF_CONFIG + "direct/Massageadmin/documents",// 打印内容
  placeFileList: INF_CONFIG + "direct/Massageadmin/handleEndList",//归档

  getOriginalInfo: INF_CONFIG + "direct/Massageadmin/getOriginalInfo",//获取原始数据信息
}


function getOriginalInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getOriginalInfo, data, fn, fn)
}
function accountManage(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.accountManage, data, fn, fn)
}
function userConfirm(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.userConfirm, data, fn, fn)
}
function forceConclude(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.forceConclude, data, fn, fn)
}

function goBackToYY(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.goBackToYY, data, fn, fn)
}

function yyAccept(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.yyAccept, data, fn, fn)
}

function getDirectArea(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getDirectArea, data, fn, fn)
}

function getLibraryGroupList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getLibraryGroupList, data, fn, fn)
}

function conclude(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.conclude, data, fn, fn)
}

function reTransfer(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.reTransfer, data, fn, fn)
}

function editAttendantInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.editAttendantInfo, data, fn, fn)
}

function getAttendantInfoById(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getAttendantInfoById, data, fn, fn)
}

function delAttendant(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.delAttendant, data, fn, fn)
}

function WdoGroupEdit(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.WdoGroupEdit, data, fn, fn)
}

function addAttendant(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.addAttendant, data, fn, fn)
}

function MseeageByQuestionNum(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MseeageByQuestionNum, data, fn, fn)
}

function getUserMseeageList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getUserMseeageList, data, fn, fn)
}

function comGetArea(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.comGetArea, data, fn, fn)
}

function comEditUserInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.comEditUserInfo, data, fn, fn)
}

function getLibraryGroup(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getLibraryGroup, data, fn, fn)
}

function comGetUserInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.comGetUserInfo, data, fn, fn)
}

function comlogout(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.comlogout, data, fn, fn)
}

function comlogin(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.comlogin, data, fn, fn)
}

function WproDel(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.WproDel, data, fn, fn)
}

function WdoEdit(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.WdoEdit, data, fn, fn)
}

function WgetEditInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.WgetEditInfo, data, fn, fn)
}

function GroupdoAdd(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.GroupdoAdd, data, fn, fn)
}

function getListByGroup(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getListByGroup, data, fn, fn)
}

function Wgroupdel(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.Wgroupdel, data, fn, fn)
}

function Wsearch(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.Wsearch, data, fn, fn)
}

function WdoEdit(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.WdoEdit, data, fn, fn)
}

function getEditInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getEditInfo, data, fn, fn)
}

function addGroup(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.addGroup, data, fn, fn)
}

function getGroupList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getGroupList, data, fn, fn)
}

function getUserList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getUserList, data, fn, fn)
}

function editAndTransfer(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.editAndTransfer, data, fn, fn)
}

function QuserDelete(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.QuserDelete, data, fn, fn)
}

function Qsupervise(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.Qsupervise, data, fn, fn)
}

function userAnalysis(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.userAnalysis, data, fn, fn)
}

function AnswerWatch(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.AnswerWatch, data, fn, fn)
}

function questionAnswer(data, fn) {
  baseAjax('GET', REQUEST_CONFIG.questionAnswer, data, fn, fn)
}

function delfile(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.delfile, data, fn, fn)
}

function wbAllList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.wbAllList, data, fn, fn)
}

function doAppeal(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.doAppeal, data, fn, fn)
}

function yxAppealList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.yxAppealList, data, fn, fn)
}

function getMessage(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getMessage, data, fn, fn)
}

function wbWaitList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.wbWaitList, data, fn, fn)
}

function logout(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.logout, data, fn, fn)
}

function MyxTransfer(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MyxTransfer, data, fn, fn)
}

function MgetAllList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MgetAllList, data, fn, fn)
}

function MuserTransfer(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MuserTransfer, data, fn, fn)
}

function MgetTransferInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MgetTransferInfo, data, fn, fn)
}

function MgetWaitList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MgetWaitList, data, fn, fn)
}

function userEdit(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.userEdit, data, fn, fn)
}

function targetListByType(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.targetListByType, data, fn, fn)
}

function MgetEditInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MgetEditInfo, data, fn, fn)
}

function MuserAdd(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MuserAdd, data, fn, fn)
}

function MaddAndTransfer(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MaddAndTransfer, data, fn, fn)
}

function getUserInfo(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.getUserInfo, data, fn, fn)
}

function menuList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.menuList, data, fn, fn)
}

function MessageGroup(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MessageGroup, data, fn, fn)
}

function targetList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.targetList, data, fn, fn)
}

function MessageDetail(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MessageDetail, data, fn, fn)
}

function MessageList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.MessageList, data, fn, fn)
}

function loginUrl(data, fn, error) {
  baseAjax('POST', REQUEST_CONFIG.loginUrl, data, fn, error)
}

function ShouLiOption(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.ShouLiOption, data, fn, fn)
}

function ShenSuOption(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.ShenSuOption, data, fn, fn)
}

function EventStatusList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.EventStatusList, data, fn, fn)
}

function ChartData(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.ChartData, data, fn, fn)
}

function printContent(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.printContent, data, fn, fn)
}

function placeFileList(data, fn) {
  baseAjax('POST', REQUEST_CONFIG.placeFileList, data, fn, fn)
}

export default {
  loginUrl: loginUrl,
  baseUrl: INF_CONFIG,
  logout: logout,
  MessageList: MessageList,
  MessageDetail: MessageDetail,
  targetList: targetList,
  MessageGroup: MessageGroup,
  menuList: menuList,
  getUserInfo: getUserInfo,
  MaddAndTransfer: MaddAndTransfer,
  MuserAdd: MuserAdd,
  MgetEditInfo: MgetEditInfo,
  targetListByType: targetListByType,
  userEdit: userEdit,
  MgetWaitList: MgetWaitList,
  MgetTransferInfo: MgetTransferInfo,
  MuserTransfer: MuserTransfer,
  MgetAllList: MgetAllList,
  MyxTransfer: MyxTransfer,
  wbWaitList: wbWaitList,
  getMessage: getMessage,
  ShouLiOption: ShouLiOption,
  ShenSuOption: ShenSuOption,
  EventStatusList: EventStatusList,
  ChartData: ChartData,
  userAnalysis: userAnalysis,
  delfile: delfile,
  Qsupervise: Qsupervise,
  QuserDelete: QuserDelete,
  AnswerWatch: AnswerWatch,
  questionAnswer: questionAnswer,
  wbAllList: wbAllList,
  yxAppealList: yxAppealList,
  editAndTransfer: editAndTransfer,
  doAppeal: doAppeal,
  getUserList: getUserList,
  getGroupList: getGroupList,
  addGroup: addGroup,
  getEditInfo: getEditInfo,
  Wsearch: Wsearch,
  Wgroupdel: Wgroupdel,
  getListByGroup: getListByGroup,
  GroupdoAdd: GroupdoAdd,
  WgetEditInfo: WgetEditInfo,
  WdoEdit: WdoEdit,
  WproDel: WproDel,
  comlogin: comlogin,
  comlogout: comlogout,
  comGetUserInfo: comGetUserInfo,
  getLibraryGroup: getLibraryGroup,
  comEditUserInfo: comEditUserInfo,
  comGetArea: comGetArea,
  getUserMseeageList: getUserMseeageList,
  MseeageByQuestionNum: MseeageByQuestionNum,
  addAttendant: addAttendant,
  WdoGroupEdit: WdoGroupEdit,
  delAttendant: delAttendant,
  getAttendantInfoById: getAttendantInfoById,
  editAttendantInfo: editAttendantInfo,
  reTransfer: reTransfer,
  conclude: conclude,
  getLibraryGroupList: getLibraryGroupList,
  getDirectArea: getDirectArea,
  yyAccept: yyAccept,
  goBackToYY: goBackToYY,
  forceConclude: forceConclude,
  printContent: printContent,
  placeFileList: placeFileList,
  userConfirm: userConfirm,
  accountManage: accountManage,
  getOriginalInfo:getOriginalInfo
}
